<%--
 * edit.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags"%>


<form:form action="${requestURI}" modelAttribute="itemForm">

	<form:hidden path="itemId" />
	<form:hidden path="seller" />


	<acme:textbox code="purchasedItem.referenceNumber"
		path="referenceNumber" readonly="true" />



	<acme:textbox code="purchasedItem.name" path="name" readonly="true" />
	<acme:textarea code="purchasedItem.description" path="description"
		readonly="true" />
	<spring:message code="purchasedItem.price" />
	<acme:textbox code="purchasedItem.amount" path="amount" readonly="true" />
	<acme:textbox code="purchasedItem.currency" path="currency"
		readonly="true" />
	<acme:textbox code="purchasedItem.units" path="purchasedUnits"
		readonly="true" />
	<acme:textbox code="purchasedItem.state" path="state" readonly="true" />

	<h1>
		<spring:message code="availableItem.comments" />
	</h1>


	<display:table pagesize="5" class="displaytag" keepStatus="true"
		name="comments" requestURI="${requestURI}" id="row">

		<spring:message code="comment.creationMoment"
			var="commentCreationMomentHeader" />
		<display:column property="creationMoment"
			title="${commentCreationMomentHeader}" sortable="true"
			format="{0,date,dd/MM/yyyy HH:mm}" />

		<spring:message code="comment.text" var="commentTextHeader" />
		<display:column property="text" title="${commentTextHeader}"
			sortable="false" />

		<spring:message code="comment.rating" var="commentRatingHeader" />
		<display:column property="rating" title="${commentRatingHeader}"
			sortable="true" />

	</display:table>

	<jstl:if test="${isBuyer}">
		<acme:cancel code="availableItem.createComment"
			url="/comment/customer/create.do?availableItemId=${availableItemId}" />

	</jstl:if>

	<acme:cancel code="purchasedItem.goBack" url="${backURI}" />

</form:form>